<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="${rootPath}/css/a.css" type="text/css" rel="stylesheet" />
<link href="${rootPath}/css/index.css" type="text/css" rel="stylesheet" />
<link href="${rootPath}/css/common.css" type="text/css" rel="stylesheet" />
<title>商户信息导出</title>

<script type="text/javascript"
	src="<s:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<s:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
<script type='text/javascript' src='<s:url value="/js/querySon.js"/>'></script>
<script type="text/javascript">
$(document).ready(function(){

      $("#sub").click(function(){
         if(!checkDate()){
           return false;
         }
		 $("#sub").attr("disabled", true);
         $("#importForm").attr("action","<%=basePath%>/merinfo/queryMerinfoExportList.ct");
		 $("#importForm").submit();
       
      });
      
      $("#szPower").click(function() {
		 $("#importForm").attr("action","<%=basePath%>/merinfo/excelMerinfoExportList.ct");
		 $("#importForm").submit();
	   });				
      
   });

	function   str2date(str){
		var d=null;   
		var reg=/^(\d{4})(\d{2})(\d{2})$/  ;
			if(arr=str.match(reg))d=new   Date(Number(arr[1]),Number(arr[2])-1,Number(arr[3])) ; 
		return   d;   
	}  

	function  checkDate(){
		var endTime = $("#crtMaxDate").val();
		var beginTime = $("#crtMinDate").val();
		
		if(!endTime || !beginTime){
			alert("起始时间范围必须选择!");
			return false;
		} 
		var date1=str2date(beginTime);
		var date2=str2date(endTime);

	    var dates = Math.abs((date1 - date2))/(1000*60*60*24);   
	    if(dates > 9){
		    alert("选择的起始时间相隔超过10天！");
			return false;
	    }
		return true;
	}
	
	function loadNewOneAgent() { 
		var	sortCode=$("#areaCode").val();
			MccQuery.loadNewOneAgentInf(sortCode, function(sortSmall) {
				fillSelect_sort("sonCode", sortSmall);
			});
		}

</script>
</head>
<body>
<table class="tb">
    <tbody>
		<s:form id="importForm" action="queryTerminalPosSN.ct" method="post"
			namespace="/terminal"  theme="simple">
			
	        <tr class="tb-line">
	            <td class="tb-td" colspan="6"><div class="tb-h2">POS收单运营管理平台</div></td>
	        </tr>
	
	        <tr class="tb-line">
	            <td class="tb-td" colspan="6"><div class="tb-h3">商户信息导出</div></td>
	        </tr>
	        <tr class="tb-line">
            <td align="right" class="tb-td">
                <div class="tb-h4">商户号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.merchantNo" />
               	</label>
            </td>
             <td align="right" class="tb-td">
                <div class="tb-h4">商户简称：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.merchantName" maxlength="20"/>
                </label>
            </td>
        </tr>

        <tr class="tb-line">
            <td align="right" class="tb-td">
                <div class="tb-h4">营业名称：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.merBrName" maxlength="25"/>
                </label>
            </td>
            
             <td align="right" class="tb-td">入网时间：</td>
			<td class="tb-td" >
				 <label class="tb-input-normal">
					<s:textfield    onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,wdate:true,errDealMode:0});"    name="searchCondition.minDate"  />
				 </label>
				-
				 <label class="tb-input-normal">
					<s:textfield  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,wdate:true,errDealMode:0});"   name="searchCondition.maxDate"   />
				</label>
			</td> 
        </tr>
		<tr class="tb-line">
            <td align="right" class="tb-td">
                <div class="tb-h4">法人名称：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.certifName" maxlength="25"/>
               	</label>
            </td>
             <td align="right" class="tb-td">
                <div class="tb-h4">法人身份证：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.cardNo" maxlength="20"/>
                </label>
            </td>
        </tr>
        <tr class="tb-line">
            <td align="right" class="tb-td">
                <div class="tb-h4">业务联系人名称：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.contactName" maxlength="25"/>
               	</label>
            </td>
             <td align="right" class="tb-td">
                <div class="tb-h4">业务联系人手机号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.phone" maxlength="15" />
                </label>
            </td>
        </tr>
        <tr class="tb-line">
            <td align="right" class="tb-td">
                <div class="tb-h4">结算账号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.accountNo" maxlength="25"/>
               	</label>
            </td>
             <td align="right" class="tb-td">
                <div class="tb-h4">结算账户姓名：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.accountName" maxlength="20" />
                </label>
            </td>
        </tr>
        <tr class="tb-line">
            <td align="right" class="tb-td">
                <div class="tb-h4">非法人身份证：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.clearCardId" maxlength="25"/>
               	</label>
            </td>
             <td align="right" class="tb-td">
                <div class="tb-h4">商户直属代理商：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.directlyAgent" maxlength="20" />
                </label>
            </td>
        </tr>
		<tr class="tb-line">
            <td align="right" class="tb-td">
                <div class="tb-h4">商户状态：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-mini">
                	<s:select list="#{'99':'请选择状态','01':'正常','03':'冻结','02':'注销' }" name="searchCondition.status" />
               	</label>
               
            </td>
            <td align="right" class="tb-td">
                <div class="tb-h4">商户连接方式：</div>
            </td>
           <td class="tb-td" >
		       <s:select  name="searchCondition.association" list="#{'1':'直连','0':'间联'}"  headerKey="99" headerValue="--请选择--" cssClass="queryWidth" /> 
      	   </td>
          </tr>
          <tr>
            <s:if test="#session.session_merchant.roleType!=\"00\" && #session.session_merchant.roleType!=\"12\" && #session.session_merchant.roleType!=\"13\"">
             <tr class="tb-line">
             <td align="right" class="tb-td">
                <div class="tb-h4">代理商：</div>
            </td>
            <td class="tb-td">
            	<select id="parentCode" name="searchCondition.parentCode" onchange="loadCity()"></select>-
            	<s:hidden id="henParentCode" value="%{searchCondition.parentCode}"/>
            	<select id="sonCode" name="searchCondition.sonCode"></select>
            	<s:hidden id="henSonCode" value="%{searchCondition.sonCode}"/>
            </td>
            </s:if>
        </tr>
	    	<tr class="tb-line">
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">创建日期：</div></td>
	            <td class="tb-td">
	                <label class="tb-input-mini">
	                	<s:textfield id="crtMinDate" name="searchCondition.crtMinDate" onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"
							theme="simple" cssClass="queryWidth" /> 
					</label>至：
					<label class="tb-input-mini">
						<s:textfield id="crtMaxDate" name="searchCondition.crtMaxDate" onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"
							theme="simple" cssClass="queryWidth" />
					</label>
					<code class="asterisk">*</code>
				</td>	
			    <td width="12%" style="min-width: 150px" align="right" class="tb-td">
			    	<div class="tb-h4">MCC</div>
			    </td>
				<td class="tb-td">
                	<label class="tb-select">
		      			<s:select list="#request.mcc" name="searchCondition.upMccCd" headerKey="" headerValue="--请选择--" />
		      		</label>
				</td>	
			</tr>
			
			<tr class="tb-line">
	            <td align="right" class="tb-td">
	                <div class="tb-h4">审核人员：</div>
	            </td>
	            <td class="tb-td">
	                <label class="tb-input-mini">
								<s:select cssClass="queryWidth" name="searchCondition.busLicCode"
									list="riskList" listKey="id" listValue="realName" 
									headerKey="-1" headerValue="--请选择--" />
	               	</label>
	               
	            </td>
	            <td align="right" class="tb-td">
	                <div class="tb-h4">营业执照号码：</div>
	            </td>
	           <td class="tb-td" >
                	<s:textfield name="searchCondition.busiLiceNo" maxLength="19"/>
	      	   </td>
	        </tr>
			<tr class="tb-line">
	            <td align="right" class="tb-td">
	                <div class="tb-h4">所属分公司：</div>
	            </td>
	            <td class="tb-td">
	                <label class="tb-input-mini">
						<s:select cssClass="queryWidth" name="searchCondition.areaCode" id="areaCode"  onchange="loadNewOneAgent(this.id)"
							list="#request.opList" listKey="id" listValue="name"  headerKey="-1" headerValue="不限" />
            			<s:hidden id="henParentCode" value="%{searchCondition.areaCode}"/>
	               	</label>
	               
	            </td>
	            <td align="right" class="tb-td">
	                <div class="tb-h4">一级代理商：</div>
	            </td>
	           <td class="tb-td" >
						<s:select cssClass="queryWidth" name="searchCondition.sonCode" id="sonCode"
								list="#request.oneAgengList" listKey="oneagentid" listValue="realName" 
								 headerKey="-1" headerValue="--请选择--"/>
            			<s:hidden id="henSonCode" value="%{searchCondition.sonCode}"/>
	      	   </td>
	        </tr>
				<tr>
					<td colspan="6">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="6" align="center"><div style="color: blue;">
							<s:actionmessage />
						</div>
						<div style="color: red;">
							<s:actionerror />
						</div>
					</td>
				</tr>

				<tr class="tb-line">
					<td class="tb-td line-submit" align="right" colspan="6">
                		<label class="tb-input-submit">
					 		<s:submit value="查询" id="sub" /> 
		                </label>
		                <label class="tb-input-submit">
				             <s:reset value="取  消" />
		                </label>
						   <s:if test="#request.searchRsList != null && #request.searchRsList.size>0">
								
				                <label class="tb-input-submit">
									<input id="szPower" type="submit" value="导出Excel" />
				                </label>
					       </s:if>
						   <s:else>
						   
			                <label class="tb-input-submit">
								<input id="szPower" disabled="disabled" value="导出Excel" type="submit" />
			                </label>
					       </s:else>
							</td>
				</tr>
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
					<tr class="tb-line">
						<td class="tb-td paging" colspan="12" align="left">&nbsp;&nbsp;&nbsp;&nbsp; <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/merinfo/queryMerinfoExportList.ct?currentPage=" />

						</td>
					</tr>
				</s:if>
			</table> 
		</s:form>
    </tbody>
</table>
<div class="big-tb">
    <table class="tb" style="width: 400%;">
				<thead>
		            <tr class="tb-line">
		                <th class="tb-th" colspan="35">商户信息列表</th>
		            </tr>
					<tr class="tb-line bg-gray">
					    <th class="tb-th" style="width: 2%">商户号</th>
						<th class="tb-th" style="width: 2%">所属机构</th>
						<th class="tb-th" style="width: 2%">商户来源渠道</th>
						<th class="tb-th" style="width: 2%">发展人推荐</th>
						<th class="tb-th" style="width: 2%">所属收单机构</th>
						<th class="tb-th" style="width: 2%">收单机构32域</th>
						<th class="tb-th" style="width: 2%">商户前三位机构代码</th>
						<th class="tb-th" style="width: 2%">商户号地区码</th>
						<th class="tb-th" style="width: 2%">MCC</th>
						<th class="tb-th" style="width: 2%">商户是否银联标准</th>
						<th class="tb-th" style="width: 2%">商户工商注册名称</th>
						<th class="tb-th" style="width: 2%">营业名称</th>
						<th class="tb-th" style="width: 2%">商户执照号</th>
						<th class="tb-th" style="width: 2%">经营范围</th>
						<th class="tb-th" style="width: 2%">主营业务</th>
						<th class="tb-th" style="width: 2%">法人代表</th>
						<th class="tb-th" style="width: 2%">法人证件类型</th>
						<th class="tb-th" style="width: 2%">法人证件号</th>
						<th class="tb-th" style="width: 2%">商户联系人姓名</th>
						<th class="tb-th" style="width: 2%">商户联系电话号码</th>
						<th class="tb-th" style="width: 2%">商户注册国家编码</th>
						<th class="tb-th" style="width: 2%">省代码</th>
						<th class="tb-th" style="width: 2%">市代码</th>
						<th class="tb-th" style="width: 2%">县代码</th>
						<th class="tb-th" style="width: 2%">地址</th>
						<th class="tb-th" style="width: 2%">结算账户名称</th>
						<th class="tb-th" style="width: 2%">结算账户</th>
						<th class="tb-th" style="width: 2%">结算账户开户行</th>
						<th class="tb-th" style="width: 2%">结算账户银行联行号</th>
						<th class="tb-th" style="width: 2%">银联终端号</th>
						<th class="tb-th" style="width: 2%">非法人身份证</th>
						<th class="tb-th" style="width: 2%">直属代理商</th>
						
						<th class="tb-th" style="width: 2%">所属分公司</th>
						<th class="tb-th" style="width: 2%">一级代理商</th>
						<th class="tb-th" style="width: 2%">审核人员</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="#request.searchRsList" status="stat" id="mer">
						<tr class="tb-line">
							<td class="tb-td" align="center" >
								<s:property value="#mer.id" 	/>
							</td>
							<td class="tb-td" align="center" >
								48500000
							</td>
							<td class="tb-td" align="center" >
								1
							</td>
							<td class="tb-td" align="center" >
								代理商
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.bankBelongCd" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.ucBccd" />
							</td>
							<td class="tb-td" align="center" >
								850
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.mchcdAreadCd" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.upMccCd" />
							</td>
							<td class="tb-td" align="center" >
								是
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.name" 	/>
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.nameBusi" 	/>
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.busiLiceNo" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.busiRang" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.busiMain" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.certif" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.certifType" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.certifNo" 	/>
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.contactName" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.contactPhoneNo" />
							</td>
							<td class="tb-td" align="center" >
								CHN
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.provCd" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.cityCd" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.areaCd" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.regAddr" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.bankAccount.name" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.bankAccount.account" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.bankAccount.bankName" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.bankAccount.bankCode" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.terminfoList[0].id.termId" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.stlmWayDesc" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.directlyAgent" />
							</td>
							
							<td class="tb-td" align="center" >
								<s:property value="#mer.companyName" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.oneagentName" />
							</td>
							<td class="tb-td" align="center" >
								<s:property value="#mer.bus_lic" />
							</td>
						</tr>
						</s:iterator>
				</tbody>
    </table>
</div>
</body>
</html>